// Bootstrap Scripting Library
with(new ActiveXObject("Scripting.FileSystemObject"))for(var x in p=(".;js;"+new ActiveXObject("WScript.Shell").Environment("PROCESS")("PATH")).split(";"))if(FileExists(j=BuildPath(p[x],"js.js"))){eval(OpenTextFile(j).ReadAll());break}
var $DIR = cd(Assert.Folder($ScriptPath));

$$("cscript clean.js");

// while it's clean, lets get the source zip files.
zip("gsToolkit-src.zip",".", ".svn/*");
zip("SvnReverseProxy-Src.zip","SvnReverseProxy", ".svn/*");

// build it
$$("msbuild.exe gsToolkit.sln /p:Configuration=Release");
Assert.Folder("output\\win32\\release\\bin");

// drop the pdb files.
for(var each in dir("output\\win32\\release\\bin", /.pdb$/) )
    erase(each);
    
// pack up the toolkit    
zip("gsToolkit.zip","output\\win32\\release\\bin", "toolkittests.exe");
cd("{$DIR}\\SvnReverseProxy");
$$('zip {$DIR}\\gsToolkit.zip Readme.txt');

// pack up SRP
cd("{$DIR}\\output\\win32\\release\\bin");
$$('zip {$DIR}\\SvnReverseProxy.zip SVNReverseProxy.exe SVNReverseProxy.exe.config');
cd("{$DIR}\\SvnReverseProxy");
$$('zip {$DIR}\\SvnReverseProxy.zip Readme.txt');

// pack up DllExport
cd("{$DIR}\\output\\win32\\release\\bin");
$$('zip {$DIR}\\DllExport.zip DllExport.exe gsToolkit.dll');
cd("{$DIR}\\DllExport");
$$('zip {$DIR}\\DllExport.zip Readme.txt');


